<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>确认订单</title>
    <script src="__INDEX__/js/mui.min.js"></script>
    <link href="__INDEX__/css/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="__INDEX__/css/iconfont.css" />
    <link rel="stylesheet" href="__INDEX__/css/style.css" />
    <link rel="stylesheet" href="__INDEX__/css/yund.css" />
</head>
<style>
	.mui-input-group, .mui-input-row {
	    height: 75px;
	}
	.mui-checkbox label, .mui-radio label {
	    display: inline-block;
	    width: 30%;
	    padding-right: 38px;
	}
	
</style>
<body>
	<header class="mui-bar mui-bar-nav">
	    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	    <h1 class="mui-title">确认订单</h1>
	</header>
	<nav class="mui-bar mui-bar-tab pay_bar_tab">
	    <a class="mui-tab-item left">合计：<em>¥<em>{$total_money}</em></em></a>
	    <a href="javascript:void(0);" onclick="confirm_pay()" class="mui-tab-item right">确认付款</a>
	</nav>
	<div class="mui-content">
		<form class="mui-input-group layui-form" id='my_form'>
		<input class="mui-input-numbox" name='address_id' type="hidden" value="{$user_address.id}"/>
	    <div class="pay_address">
	    	<a href="{:url('member/address')}">
	    		<p class="clearfix">
	    			<span class="pay_addr_name">{$user_address['consignee']}</span>
	    			<span class="pay_addr_call">{$user_address['mobile']}</span>
	    		</p>
	    		<p class="pay_addrinfo">{$user_address['address']}</p>
	    	</a>
	    </div>
	    {volist name="order_list" id="order_info" empty="没有数据"}
	    <div class="pay_ordinfo" style="margin-bottom: 0px;">
	    	<p class="pay_ord_dpmc"><span class="iconfont icon-shangcheng"></span>{$order_info['agent_name']}</p>
	    	{volist name="$order_info.order_item" id="order_item"}
	    	<ul class="pay_ord_list qqdd_list">
	    		<li>
	    			<div class="pay_ord_sp clearfix">
			    		<div class="pay_sp_img"><img src="{$order_item.thumb}"></div>
			    		<div class="pay_sp_info">
			    			<p class="pay_spnam">{$order_item.goods_name}</p>
			    			<p class="pay_sppribox clearfix">
			    				<span class="pay_sppri">¥{$order_item.price}<em>¥{$order_item.sale_price}</em></span>
			    				<span class="pay_spnum">X{$order_item.nums}</span>
			    			</p>
			    		</div>
			    	</div>
	    		</li>
	    	</ul>
			{/volist}
			<div class="layui-form-item">
			    <label class="layui-form-label" style="width: 30%;">配送方式：</label>
			    <div class="layui-input-block" style="text-align: center;">
			    	<input type="radio" name="express_type{$order_info.id}" value="1" title="快递">
			    	<input type="radio" name="express_type{$order_info.id}" value="2" title="到店自取" checked>
			    </div>
			</div>
	    	<div class="pay_ord_liuy">
	    		<label>买家留言:</label>
	    		<input type="text" name="memo{$order_info.id}" id='memo{$order_info.id}' placeholder="选填（对本次交易的说明）"></input>
	    	</div>
	    	<div class="pay_ord_zj " >
	    		<span>共 {:count($order_info.order_item)}件商品</span>
	    		<span>小计：<em>¥<em>{$order_info.total_price}</em></em></span>
	    	</div>
	    </div>
	{/volist}
	    <!--<div class="pay_paystyle" style="height: 45px;background-color: #fff;margin-bottom: 55px;">
			<div class=" mui-checkbox"><!--'支付方式1现金2微信3支付宝4银联',
				<label style="float: left;font-size: 18px;margin-right: 56%;">小卡支付</label>
				<input name="pay_type" value="2" type="checkbox" checked >
			</div>
		</div>-->
		<!--<div class="pay_paystyle" style="height: 45px;background-color: #fff;">
			<div class=" mui-checkbox">
				<label style="float: left;font-size: 18px;margin-right: 56%;">微信支付</label>
				<input name="pay_type" value="2" type="checkbox" checked >
			</div>
		</div>-->
		<div class="pay_ord_zj" style="margin-bottom: 1%;"></div>
	</form>
	</div>
</body>
</html>
{include file="public/footer" /}
<script>
	function confirm_pay(){
		layer.confirm('您确定需要付款吗？', {
			btn: ['确定', '取消'] //按钮
		}, function() {
			var order_arr = "{$order_arr}";
			var order_ids = order_arr.split(",");
			
			var post_data ="";
			
			for(var i=0;i<order_ids.length;i++){
				//获取快递方式
				var express_type =  $("input[name='express_type"+order_ids[i]+"']:checked").val();
				
				//获取留言
				var memo = $('#memo'+order_ids[i]).val();
				
				post_data +=order_ids[i]+":"+express_type+","+memo+"|";
			}
			
			$.ajax({
				type:"post",
				url: "{:url('index/shop/pay_order')}",
				data: {post_data:post_data},//表单数据
				success: function(data) {
					layer.msg(data.msg, {
					  icon: 1,
					  time: 1500 //2秒关闭（如果不配置，默认是3秒）
					}, function(){
						  if(data.code == 200) {
								location.href = data.url
						  }
					}); 
				}
			})
		})
	}
	
</script>